<!DOCTYPE html>
<html siteid="{{$siteid}}">
    <head>
        <meta charset="utf-8">
        <meta name="renderer" content="webkit|ie-comp|ie-stand">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
        <meta name="author" content="luomingui">
        <title>
            {{if get_config('seotitletype') eq '1' }}
            {{$title}} {{get_config('keywords')}}
            {{elseif get_config('seotitletype') eq '2'}}
            {{$title}} {{get_config('webname')}}
            {{elseif get_config('seotitletype') eq '3'}}
            {{$title}} {{get_config('keywords')}} {{get_config('webname')}}
            {{else}}
            {{$title}}
            {{/if}}
        </title>
        <base href="{{SITE_URL}}"/>
        <link href="{{STATIC_URL}}/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet">
        <script src="{{STATIC_URL}}/plugins/jquery/jquery.min.js?v{{random(4)}}"></script>
        <script src="{{STATIC_URL}}/home/jquery.qqFace.js?v{{random(4)}}"></script>
        <script src="{{STATIC_URL}}/common/js/luomg.js?v{{random(4)}}"></script>
        <script>var is_debug = true;var _speedMark = new Date();</script>
        <style  type="text/css">
            .ind_bt {font-size: 16px;color: #464646;height: 35px;line-height: 30px;font-weight: normal;border: 1px solid #DBDBDB;border-top: 5px solid #09c;overflow: hidden;padding-left: 20px;background: #fff;padding-right: 10px;}
            span.emotion {width: 50px;height: 20px; background: url(/static/home/icon.gif) no-repeat 2px 2px;padding-left: 20px;cursor: pointer;color: #999;}
            .comment {position: relative;margin: 20px 0;}
            .comment_list{border:1px solid #ccc;margin:16px 0 15px;}
            .comment_list_top{background:#fbfbfb;color:#555;font-size:14px;padding:0 12px;font-weight:bold;height:30px;line-height: 30px;border-bottom: 1px dotted #ddd;}
            .comment_list_body ul{padding:0 12px;}
            .comment_list_body ul li{padding:10px 0;border-bottom: 1px dotted #ddd;overflow:hidden;}
            .comment_list_body ul li:last-child{border-bottom:none;}
            .comm_right{margin-left:50px;}
            .user_name{color:#017cb9}
            .user_name:hover{color:#2a6496;text-decoration:underline;transition: all 0.15s linear 0s;}
            .user_pic{float:left;}
            .comm_right p{font-size: 14px;line-height: 1.5em;color:#666;margin:5px 0;}
            .original_comment{display:block;margin:5px 0;}
            .comm_time{font-size:12px;color:#999;}
            .comm_a{font-size:12px;color:#999;margin:0 5px;transition: all 0.15s linear 0s;}
            .comm_a:hover{color:#555}
            .none{display:none;}
            .rep_cont{padding:10px 0;}
        </style>
    </head>
    <body><a name="top"></a>
        <!-- 评论区 开始 -->
        <h3 class="ind_bt">评论区</h3>
        <div class="comment">
            <div class="com_form">
                <form action="{{url('/comment/index/index')}}" method="post"  onsubmit="return check_comm(this)">
                    <input type='hidden' name='formhash' value="{{FORMHASH}}" />
                    <input type='hidden' name='id' value="{{$smarty.get.id}}" />
                    <input type='hidden' name='idtype' value="{{$smarty.get.idtype}}" />
                    <textarea class="form-control" rows="5"  id="content" name="content" placeholder="我来说两句~"></textarea>
                    <p style="height: 24px;margin-top: 10px;margin-bottom: 10px;">
                        <input type="submit" class="btn btn-default" style="float: right;" name="dosubmit" value="提交" />
                        <span class="emotion"   style="float:left;">表情</span>
                    </p>
                </form>
            </div>
        </div>
        <div class="comment_list">
            <div class="comment_list_top">共{{$items_count}}条评论</div>
            <div class="comment_list_body">
                <ul>
                    {{foreach $items as $item}}
                    <li>
                        <a class="user_pic"><img src="/api/index/avatar/?uid={{$item.uid}}&size=smal&v={{random(4)}}" height="35" width="35"></a>
                        <div class="comm_right">
                            <a class="user_name" href="http://localhost:88/member/myhome/init/userid/1.html" target="blank">{{$item.username}}</a>
                            {{$item.message}}
                            {{$item.childs}}
                            <p><span class="comm_time">{{date("Y-m-d H:i:s",$item.dateline)}}</span> <a href="javascript:toreply('{{$item.cid}}');" class="comm_a">回复</a></p>
                            <div id="rep_{{$item.cid}}" class="none">
                                <form action="{{url('/comment/index/index')}}" method="post"  onsubmit="return check_rep(this)">
                                    <input type='hidden' name='formhash' value="{{FORMHASH}}" />
                                    <input type='hidden' name='id' value="{{$smarty.get.id}}" />
                                    <input type='hidden' name='idtype' value="{{$smarty.get.idtype}}" />
                                    <input type="hidden" name="reply" value="{{$item.cid}}" />
                                    <input type="hidden" name="reply_to" value="{{$item.uid}}" />
                                    <textarea name="content" class="form-control" rows="5"  placeholder="我来说两句~"></textarea><br>
                                    <input type="submit" class="btn btn-default" name="dosubmit" value="提交" style="float: right;" />
                                </form>
                            </div>
                        </div>
                    </li>
                    {{/foreach}}
                    {{if empty($items)}}<li>这篇文章还没有收到评论，赶紧来抢沙发吧~</li>{{/if}}
                </ul>
            </div>
        </div>
        <script type="text/javascript">
            $(function () {
                $('.emotion').qqFace({
                    path: '/static/home/face/'
                });
            });
            function toreply(obj) {
                if ($("#rep_" + obj).css("display") == "none") {
                    $("#rep_" + obj).css("display", "block");
                } else {
                    $("#rep_" + obj).css("display", "none");
                }
            }

            function check_comm(obj) {
                var content = obj.content.value;
                if (content === '') {
                    alert('你不打算说点什么吗？');
                    return false;
                }
                return true;
            }

            function check_rep(obj) {
                var content = obj.content.value;
                if (content === '') {
                    alert('你不打算说点什么吗？');
                    return false;
                }
                return true;
            }
            // 计算页面的实际高度，iframe自适应会用到
            function calcPageHeight(doc) {
                var cHeight = Math.max(doc.body.clientHeight, doc.documentElement.clientHeight)
                var sHeight = Math.max(doc.body.scrollHeight, doc.documentElement.scrollHeight)
                var height = Math.max(cHeight, sHeight)
                return height
            }
            window.onload = function () {
                var height = calcPageHeight(document)
                parent.document.getElementById('ifrcommnet').style.height = height + 'px'
            }
        </script>
    </body>
</html>